package com.zhong.system.service;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhong.system.domain.SysRoleMenu;
import com.zhong.system.mapper.SysRoleMenuMapper;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

@Service
public class SysRoleMenuService extends ServiceImpl<SysRoleMenuMapper, SysRoleMenu> {

    public List<SysRoleMenu> findListByRoleIdList(List<String> roleIdList){
        return list(Wrappers.<SysRoleMenu>lambdaQuery().in(SysRoleMenu::getRoleId,roleIdList));
    }

    public boolean removeByRoleId(String roleId){
        return remove(Wrappers.<SysRoleMenu>lambdaQuery().eq(SysRoleMenu::getRoleId,roleId));
    }

    public List<SysRoleMenu> findListByRoleId(String roleId){
        return list(Wrappers.<SysRoleMenu>lambdaQuery().eq(SysRoleMenu::getRoleId,roleId));
    }

    public boolean removeByRoleIds(String[] roleIds){
        return remove(Wrappers.<SysRoleMenu>lambdaQuery().in(SysRoleMenu::getRoleId, Arrays.asList(roleIds)));
    }
}
